<template>
  <div>
    <p>你要买商品的数量:{{num}}</p>
    <button v-on:click="num = num+1">增加1</button>
    <button v-on:click="add">减少1</button>
    <button v-on:click="addfn(5)">加5</button>
  </div>
</template>

<script>
export default {
  data () {
    return {
      num:0
    }
  },
methods: {
  add(){
    this.num--
  },
  addfn(num){
    this.num+=num
  }
}
}
</script>

<style>

</style>